package com.yxjwzpx.management.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.yxjwzpx.management.domain.RepairCost;
import com.yxjwzpx.management.mapper.RepairCostMapper;
import com.yxjwzpx.management.service.IRepairCostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 维修成本Service业务层处理
 * 
 * @author yxjwzpx
 * @date 2025-04-09
 */
@Service
public class RepairCostServiceImpl implements IRepairCostService 
{
    @Override
    public List<Map<String, Object>> getMonthlyCostTrend(Long companyId) {
        return repairCostMapper.getMonthlyTrend(companyId);
    }




    @Autowired
    private RepairCostMapper repairCostMapper;

    /**
     * 查询维修成本
     * 
     * @param costId 维修成本主键
     * @return 维修成本
     */
    @Override
    public RepairCost selectRepairCostByCostId(Long costId)
    {
        return repairCostMapper.selectRepairCostByCostId(costId);
    }

    /**
     * 查询维修成本列表
     * 
     * @param repairCost 维修成本
     * @return 维修成本
     */
    @Override
    public List<RepairCost> selectRepairCostList(RepairCost repairCost)
    {
        return repairCostMapper.selectRepairCostList(repairCost);
    }

    /**
     * 新增维修成本
     * 
     * @param repairCost 维修成本
     * @return 结果
     */
    @Override
    public int insertRepairCost(RepairCost repairCost)
    {
        repairCost.setCreateTime(DateUtils.getNowDate());
        return repairCostMapper.insertRepairCost(repairCost);
    }

    /**
     * 修改维修成本
     * 
     * @param repairCost 维修成本
     * @return 结果
     */
    @Override
    public int updateRepairCost(RepairCost repairCost)
    {
        repairCost.setUpdateTime(DateUtils.getNowDate());
        return repairCostMapper.updateRepairCost(repairCost);
    }

    /**
     * 批量删除维修成本
     * 
     * @param costIds 需要删除的维修成本主键
     * @return 结果
     */
    @Override
    public int deleteRepairCostByCostIds(Long[] costIds)
    {
        return repairCostMapper.deleteRepairCostByCostIds(costIds);
    }

    /**
     * 删除维修成本信息
     * 
     * @param costId 维修成本主键
     * @return 结果
     */
    @Override
    public int deleteRepairCostByCostId(Long costId)
    {
        return repairCostMapper.deleteRepairCostByCostId(costId);
    }
}
